import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/postup',
    name: 'Postup',
    component: () => import('../views/PostUp.vue'),
  },
  {
    path: '/article_detail',
    name: 'article_detail',
    component: () => import('../views/ArticleDetail.vue'),
  },
  {
    path: '/',
    // 路由重定向：当访问：/时，将会立即跳转到：/index
    redirect: '/login'
  },
  {
    path: '/about',
    name: 'about',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  },
  { 
    meta:{
      keepAlive:true,
    },
    path: '/index',
    name: 'index',
    component: () => import('../views/Index.vue'),
  },


  {
    path: '/login',
    name: 'login',
    component: () => import('../views/Login.vue'),
  },
  {
    path: '/msg',
    name: 'msg',
    component: () => import('../views/Msg.vue'),
  },
  {
    path: '/mine',
    name: 'mine',
    component: () => import('../views/Mine.vue'),
  },
  {
    path: '/friend',
    name: 'friend',
    component: () => import('../views/Friend.vue'),
  },
  {
    path: '/addfriend',
    name: 'addfriend',
    component: () => import('../views/AddView.vue'),
  },
  {
    path: '/ftpwd',
    name: 'ftpwd',
    component: () => import('../views/Ftpwd.vue'),
  },
  {
    path: '/register',
    name: 'register',
    component: () => import('../views/Register.vue'),
  },
  {
    path: '/myinfo',
    name: 'myinfo',
    component: () => import('../views/MyInfo.vue'),
  },
  {
    path: '/headericon',
    name: 'headericon',
    component: () => import('../views/HeaderIcon.vue'),
  },
  {
    path: '/nickname',
    name: 'nickname',
    component: () => import('../views/NickName.vue'),
  },
  {
    path: '/signword',
    name: 'signword',
    component: () => import('../views/SignWord.vue'),
  },
  {
    path: '/gender',
    name: 'gender',
    component: () => import('../views/Gender.vue'),
  },
  {
    path: '/birthday',
    name: 'birthday',
    component: () => import('../views/Birthday.vue'),
  },
  {
    path: '/cellphone',
    name: 'cellphone',
    component: () => import('../views/CellPhone.vue'),
  },
  {
    path: '/city',
    name: 'city',
    component: () => import('../views/City.vue'),
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
